using System;
using System.ServiceModel;
using Agron.Services.Contracts;
using System.Globalization;


namespace Agron.Services.Broadcasting
{
    public class BroadcastingServiceProxy
    {
        public void CreateProxy(string hostAddressOrName)
        {
            if (string.IsNullOrEmpty(hostAddressOrName))
                throw new ArgumentNullException("hostAddressOrName");

            // Build remote address uri
            string addressTemplate = string.Format(CultureInfo.InvariantCulture, "net.tcp://{0}/Agron/BroadcastingService", hostAddressOrName);
            
            NetTcpBinding binding = new NetTcpBinding();
            EndpointAddress address = new EndpointAddress(addressTemplate);

            ChannelFactory<IBroadcastingService> channelFactory = new ChannelFactory<IBroadcastingService>(binding, address);
            IBroadcastingService serviceChannel = channelFactory.CreateChannel();
            
        }
    }
}
